package com.lifang.framework.aop.framework;

import com.lifang.framework.aop.MethodMatcher;
import com.lifang.framework.aop.aspectj.AbstractAspectJAdvice;
import org.aopalliance.intercept.MethodInterceptor;

public class InterceptorAndDynamicMethodMatcher {

    private final MethodMatcher methodMatcher;

    private final MethodInterceptor methodInterceptor;

    public InterceptorAndDynamicMethodMatcher(MethodMatcher methodMatcher, MethodInterceptor methodInterceptor) {
        this.methodMatcher = methodMatcher;
        this.methodInterceptor = methodInterceptor;
    }

    public InterceptorAndDynamicMethodMatcher(AbstractAspectJAdvice aspectJAdvice){
        this.methodInterceptor = aspectJAdvice;
        this.methodMatcher = aspectJAdvice.getPointcut().getMethodMatcher();
    }

    public MethodMatcher getMethodMatcher() {
        return methodMatcher;
    }

    public MethodInterceptor getMethodInterceptor() {
        return methodInterceptor;
    }
}
